package com.wlcorp.forcazamis.dao.system.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.ibatis.dao.client.DaoException;
import com.wlcorp.forcazamis.dao.system.IRoleDAO;
import com.wlcorp.forcazamis.domain.system.Role;


public class RoleDAOImpl extends HibernateDaoSupport implements IRoleDAO{
	
	public void deleteRole(Role role) throws DaoException{
		role.setDeleteFlag(true);
		getHibernateTemplate().update(role);
	}
	public Role getRoleById(Long roleId) throws DaoException{
		return (Role)getHibernateTemplate().get(Role.class, roleId);
	}
	@SuppressWarnings("unchecked")
	public List getRoleList(Role role) throws DaoException{
		return getHibernateTemplate().find("from Role as role where role.deleteFlag=false");
	}
	public void saveRole(Role role) throws DaoException{
		getHibernateTemplate().saveOrUpdate(role);
	}

	
}